import Utils from '../utils/Utils';

/**
 * API functions for experiment management
 * These functions interact with the Python backend through Geppetto
 */

/**
 * Get all experiments
 */
export const getExperiments = (): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.experiments.get_experiments', []);

/**
 * Get a specific experiment by name
 */
export const getExperiment = (name: string): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.experiments.get_experiment', [name]);

/**
 * Remove an experiment by name
 */
export const removeExperiment = (name: string): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.experiments.remove_experiment', [name]);

/**
 * Add a new experiment
 */
export const addExperiment = (experiment: any): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.experiments.add_experiment', [experiment]);

/**
 * Edit an existing experiment
 */
export const editExperiment = (name: string, experiment: any): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.experiments.edit_experiment', [name, experiment]);

/**
 * Get model parameters as JSON
 */
export const getParameters = (): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.getModelAsJson', []);

/**
 * Get model specification for a specific experiment and trial
 */
export const getModelSpecification = (name: string, trial: number): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.experiments.get_model_specification', [name, trial]);

/**
 * Get run configuration
 */
export const getRunConfiguration = (): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.get_run_configuration', []);

/**
 * Edit run configuration
 */
export const editRunConfiguration = (runConfig: any): Promise<any> =>
  Utils.evalPythonMessage('netpyne_geppetto.edit_run_configuration', [runConfig]);

